<?php
/**
 * 定义f:radio控件
 *
 * @package if
 * @subpackage module.ui
 * @since 1.1.0
 */
class UIFormRadio extends UIFormElement {
	protected $tpl = "form_radio";
	
	function _after_parse() {
		parent::_after_parse();
		$this->setAttr("type", "radio");
		
		//从f:radios继承属性
		$radios = $this->parent("f:radios");
		if ($radios) {
			if ($radios->attr("name") && !$this->attr("name")) {
				$this->setAttr("name", $radios->attr("name"));
			}
		}		
		
		//是否checked
		$name = $this->attr("name");
		if ($this->attr("value") == $this->request($name)) {
			if ($this->can("redisplay")) {
				$this->setAttr("checked", "checked");
			}
		}
	}
}

?>